package com.xiaohe66.web.infrastructure.domain.adapter.im;

import com.xiaohe66.web.domain.im.value.ImUserId;
import com.xiaohe66.web.domain.im.value.ImUserNickname;
import com.xiaohe66.web.domain.im.value.ImUserPublicKey;
import com.xiaohe66.web.domain.im.value.ImUserSignature;
import com.xiaohe66.web.infrastructure.domain.adapter.DataConverter;

/**
 * @author xiaohe
 * @since 2023.09.07 16:27
 */
public interface ImUserConverter extends DataConverter {

    default ImUserId newId(Long value) {
        return ifPresent(value, ImUserId::new);
    }

    default ImUserNickname newNickname(String value) {
        return ifPresent(value, ImUserNickname::new);
    }

    default ImUserSignature newSignature(String value) {
        return ifPresent(value, ImUserSignature::new);
    }

    default ImUserPublicKey newPublicKey(String value) {
        return ifPresent(value, ImUserPublicKey::new);
    }

}
